import request from '@/utils/request'

// 获取商品列表
export const getProductList = (obj) => {
  const { sortPrice, sortType, categoryId, goodsName, page } = obj
  return request.get('/goods/list', {
    params: {
      sortPrice,
      sortType,
      categoryId,
      goodsName,
      page
    }
  })
}

// 获取商品详情
export const getProductDetail = (goodsId) => {
  return request.get('/goods/detail', {
    params: {
      goodsId
    }
  })
}

// 获取商品评论列表
export const getCommentList = (goodsId, limit) => {
  return request.get('/comment/listRows', {
    params: {
      goodsId,
      limit
    }
  })
}

// 获取商品评论总数
export const getCommentCount = (goodsId) => {
  return request.get('/comment/total', {
    params: {
      goodsId
    }
  })
}
